Uploading files

Latest update: September 2017

Overview

This tutorial introduces the file features of FlashAir IoT Hub.

Using the file function, you can upload a picture taken from the camera containing FlashAir automatically to FlashAir IoT Hub and see the picture from the browser.

  • Upload / download files other than images
  • Delete file
  • Batch download

How to operate the screen

List display

Select "File" on the screen to display a list of files uploaded from FlashAir.

In addition to the file name and the upload date, the thumbnail of the image file is displayed in the list, and the file other than the image is displayed the icon.

Clicking the thumbnail of an image Preview display, and download that file except images.

FlashAir IoT Hub file screen 1
FlashAir IoT Hub file screen 2

In FlashAir IoT Hub, the uploaded file has a retention period of one week, and it is automatically deleted one week after the upload date.
Please be careful.

When the file is deleted immediately, an icon indicating attention will be displayed as follows, so please use as a guide.

Image retention period Image retention period warning 1 Image retention period warning 2

Preview display

Click on the thumbnail image in the list to magnify and display the image.

  1. File name
    Displays the file name of the image.
  2. Upload date
    Display the date and time the image was uploaded. Please note that it is not the shooting date and time of the image and the update date and time.
  3. Download button
    Click to download the image.
  4. Expansion button
    Click to increase the display magnification of the image.
  5. Reduce button
    Click to reduce the display magnification of the image.
  6. Close button
    Click to close the image preview display and return to the list display.
  7. Previous button
    Click to display the previous image in the image list.
  8. Next button
    Click to display the next image in the image list.

Delete file

If you put a check in the bottom right of the file, a menu will be displayed. If you click "Delete" from that menu, you can delete the checked file. Please note that deletion of files can not be undone.

File delete menu
Delete file dialog

Batch download

If you put a check in the bottom right of the file, a menu will be displayed. You can download the checked file by clicking "Download" from that menu. If you select more than one file, compress it to a zip file and download it.

File download menu
File compression in progress

Upload image

Here is an example of uploading photos taken with the camera to the FlashAir IoT Hub.

Please prepare to be able to connect from FlashAir to FlashAir IoT Hub in advance referring to Flow of use.

CONFIG file change

Edit the FlashAir CONFIG file. Please set the following value in /SD_WLAN/CONFIG.

LUA_SD_EVENT=/upload_image.lua

I have specified that Lua script to upload images be executed when writing files.

* If you do not upload images, please comment out LUA_RUN_SCRIPT in the CONFIG file. When Lua script specified by LUA_RUN_SCRIPT and LUA_SD_EVENT are executed at the same time, it may not work well.

When you insert FlashAir in the camera, it is ready. With this alone you can upload photos from the camera automatically!

Upload photos

Let's take a picture with a camera that actually inserted FlashAir and see the "file" of FlashAir IoT Hub.
* When shooting please go in a place where FlashAir can connect to the access point.

Loading image
Image upload completed

Photographs taken were uploaded to FlashAir IoT Hub automatically.

In this tutorial, I upload only newly shot pictures, but please upload all saved pictures to FlashAir and try to change them by devising them yourself.

Upload non-image

Here is an example of uploading the video taken with the camera to FlashAir IoT Hub.

In the above I uploaded images, I think that sometimes I want to upload a video from a camera other than photos.

In such a case, let's upload the file from FlashAir in the following way.

CONFIG file change

Edit the FlashAir CONFIG file. Please set the following value in /SD_WLAN/CONFIG.

LUA_SD_EVENT=/upload_file.lua

I have specified that a Lua script to upload files should be executed when writing files.

* If you do not upload images, please comment out LUA_RUN_SCRIPT in the CONFIG file. When Lua script specified by LUA_RUN_SCRIPT and LUA_SD_EVENT are executed at the same time, it may not work well.

Finally, FlashAir is ready to insert in the camera.

Upload video

Take a movie with the camera that inserted FlashAir and take a look at the "file" of FlashAir IoT Hub.
* When shooting please go in a place where FlashAir can connect to the access point.
* It may take time to upload videos.

Loading video
Video upload completed

Video uploaded! Please download and play the uploaded file.

Change folder to be uploaded

In the example above, I uploaded an example of uploading movie files, but I think that you may want to upload a file of sensor data written in FlashAir as it is.

upload_file.lua uploads the latest file under the /DCIM folder, but if you want to change this to an arbitrary folder, edit it as follows.

upload_file.lua

print("HTTP/1.1 200 Internal OK\n\n")
local last_fname = ""
local last_fpath = ""
local last_modif = 0
local last_moddir = 0
local last_dirname = "/DCIM"
local fpath = "/DCIM"
(snip)
  • Lines 6-7:
    Change the values of the variables last_dirname, fpath to the folder path where the file you want to upload is written.

This will be able to automatically send sensor data from FlashAir.

Send a CSV file to the FlashAir IoT Hub and display it on a graph, or send the GPIO value etc. , We offer various ways to send data, so why not try it?